package day13;
/**
 * 计算器九格练习
 */
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class JFrameDemo3 {
	public static void main(String[] args) {
		JFrame frame = new JFrame("欢迎");
		JPanel panel = new JPanel();
		panel.setLayout(new GridLayout(3, 3));
		frame.add(panel);
		JButton [] buttons = new JButton[9];
		for(int i = 0; i < buttons.length; i++) {
			buttons[i] = new JButton((i + 1) + "");
			panel.add(buttons[i]);
		}
		frame.setSize(500, 500);
		frame.setLocation(530, 450);
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
}
